/**
 * Copyright (c) 2016-2019 人人开源 All rights reserved.
 *
 * https://www.renren.io
 *
 * 版权所有，侵权必究！
 */

package org.biubiu0002.baiblog.common.exception;

/**
 * 自定义异常
 *
 * @author Mark sunlightcs@gmail.com
 */

public class BaiBlogException extends RuntimeException {
	private static final long serialVersionUID = 1L;


    private String errorCode = BizCodeEnumException.UNKNOWN_SERVER_EXCEPTION.getCode();
    private String errorMsg = BizCodeEnumException.UNKNOWN_SERVER_EXCEPTION.getMsg();

    public BaiBlogException(){
    	super();
	}

	public BaiBlogException(BizCodeEnumException enumException){
    	super(enumException.getMsg());
    	errorCode=enumException.getCode();
    	errorMsg=enumException.getMsg();
	}

	public BaiBlogException(BizCodeEnumException enumException, String msg){
		super(enumException.getMsg());
		errorCode=enumException.getCode();
		errorMsg=enumException.getMsg()+" : "+ msg;

	}

    public BaiBlogException(String msg) {
		super(msg);
		this.errorMsg = msg;
	}
	
	public BaiBlogException(String msg, Throwable e) {
		super(msg, e);
		this.errorMsg = msg;
	}
	
	public BaiBlogException(String msg, String code) {
		super(msg);
		this.errorMsg = msg;
		this.errorCode = code;
	}
	
	public BaiBlogException(String msg, String code, Throwable e) {
		super(msg, e);
		this.errorMsg = msg;
		this.errorCode = code;
	}

	public String getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	public String getErrorMsg() {
		return errorMsg;
	}

	public void setErrorMsg(String errorMsg) {
		this.errorMsg = errorMsg;
	}
}
